43fa7ab42beeb57860d3b666c9154a9d85e8bbb6,src/main/java/gsn/beans/StreamSource.java,StreamSource,validate,#,230
Before Change
.append( getAlias( ) ).toString( ) );
else if(samplingRate > 1){
samplingRate = 1;
logger.warn( new StringBuilder( ).append( "The provided sampling rate is greater than 1, resetting it to 1. StreamSource = " )
.append( getAlias( ) ).toString( ) );
}
if (getAddressing().length==0) {
logger.warn(new StringBuilder("Validation failed because there is no addressing predicates provided for the stream source (the addressing part of the stream source is empty)").append("stream source alias = ").append(getAlias()).toString());
return validationResult=false;
}
if ( this.rawHistorySize != null ) {
this.rawHistorySize = this.rawHistorySize.replace( " " , "" ).trim( ).toLowerCase( );
if ( this.rawHistorySize.equalsIgnoreCase( "" ) ) return validationResult = true;
final int second = 1000;
final int minute = second * 60;
final int hour = minute * 60;
final int mIndex = this.rawHistorySize.indexOf( "m" );
final int hIndex = this.rawHistorySize.indexOf( "h" );
final int sIndex = this.rawHistorySize.indexOf( "s" );
if ( mIndex < 0 && hIndex < 0 && sIndex < 0 ) {
try {
this.parsedStorageSize = Long.parseLong(this.rawHistorySize );
this.isStorageCountBased = true;
windowingType = WindowType.TUPLE_BASED;
} catch ( final NumberFormatException e ) {
logger.error( new StringBuilder( ).append( "The storage size, " ).append( this.rawHistorySize ).append( ", specified for the Stream Source : " ).append( this.getAlias( ) ).append(
" is not valid." ).toString( ) , e );
return (validationResult= false);
}
} else
try {
final StringBuilder shs = new StringBuilder( this.rawHistorySize );
if ( mIndex >= 0 && mIndex == shs.length() - 1) this.parsedStorageSize = Long.parseLong(shs.deleteCharAt( mIndex ).toString( ) ) * minute;
else if ( hIndex >= 0 && hIndex == shs.length() - 1) this.parsedStorageSize = Long.parseLong( shs.deleteCharAt( hIndex ).toString( ) ) * hour;
else if ( sIndex >= 0 && sIndex == shs.length() - 1) this.parsedStorageSize = Long.parseLong( shs.deleteCharAt( sIndex ).toString( ) ) * second;
else Long.parseLong("");
this.isStorageCountBased = false;
windowingType = WindowType.TIME_BASED;
} catch ( NumberFormatException e ) {
logger.debug( e.getMessage( ) , e );
logger.error( new StringBuilder( ).append( "The storage size, " ).append( this.rawHistorySize ).append( ", specified for the Stream Source : " ).append( this.getAlias( ) ).append(
" is not valid." ).toString( ) );
return (validationResult=false);
}
}
logger.debug("validate() called");
//Parsing slide value
if(this.rawSlideValue == null){
//If slide value was not specified by the user, consider it as 1 tuple
After Change
logger.warn("The sampling rate is set to zero (or negative) which means no results. StreamSource = " + getAlias( ));
else if(samplingRate > 1){
samplingRate = 1;
logger.warn("The provided sampling rate is greater than 1, resetting it to 1. StreamSource = " + getAlias( ));
}
if (getAddressing().length==0) {
logger.warn("Validation failed because there is no addressing predicates provided for the stream source (the addressing part of the stream source is empty) stream source alias = "+getAlias());
return validationResult=false;
}
if ( this.rawHistorySize != null ) {
this.rawHistorySize = this.rawHistorySize.replace( " " , "" ).trim( ).toLowerCase( );
if ( this.rawHistorySize.equalsIgnoreCase( "" ) ) return validationResult = true;
final int second = 1000;
final int minute = second * 60;
final int hour = minute * 60;
final int mIndex = this.rawHistorySize.indexOf( "m" );
final int hIndex = this.rawHistorySize.indexOf( "h" );
final int sIndex = this.rawHistorySize.indexOf( "s" );
if ( mIndex < 0 && hIndex < 0 && sIndex < 0 ) {
try {
this.parsedStorageSize = Long.parseLong(this.rawHistorySize );
this.isStorageCountBased = true;
windowingType = WindowType.TUPLE_BASED;
} catch ( final NumberFormatException e ) {
logger.error( "The storage size, " + this.rawHistorySize + ", specified for the Stream Source : " + this.getAlias( ) + " is not valid.", e );
return (validationResult= false);
}
} else